import React, { useReducer } from 'react'
const initState = {
  count: 0,
  msg: '嘿嘿',
  info: '静哥狂喜曲',
}

function reducer(state, action) {
  switch (action.type) {
    case 'inc':
      return {
        ...state,
        count: state.count + 1,
      }
  }
}
export default function App() {
  const [state, dispatch] = useReducer(reducer, initState)
  return (
    <div>
      <p>{state.count}</p>
      <button
        onClick={() => {
          dispatch({ type: 'inc' })
        }}
      >
        按钮
      </button>
    </div>
  )
}
